/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-03-15
 * Time: 16:43
 */
public class Date {
    public int year;
    public int moth;

    //无参构造方法
    public Date() {
        this(2024,3);//// 调用另一个构造方法
    }

    //带一个参数的构造方法

    public Date(int year) {
        this.year = year;
    }

    // 带两个参数的构造方法
    public Date(int year, int moth) {
        this.year = year;
        this.moth = moth;
    }

    public void displayInfo() {
        System.out.println(this.year + "/" + this.moth);
    }

    public static void main(String[] args) {
        Date date1 = new Date();
        Date date2 = new Date(2);
        Date date3 = new Date(2025,3);

        date1.displayInfo();//输出：2024/3
        date2.displayInfo();//输出：2/0
        date3.displayInfo();//输出：2025/3
    }
}
